package com.ysd.modules.app.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.ysd.common.utils.R;
import com.ysd.modules.app.entity.ChapterResult;
import com.ysd.modules.app.entity.VideoResult;
import com.ysd.modules.app.service.ChapterVideoService;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

@RestController
@RequestMapping("/app")
@Api(description = "APP课程视频接口")
public class ChapterVideoController {

	 @Autowired
	 private ChapterVideoService chapterVideoService;
	 
	 @ApiOperation("我的视频课程")
	 @GetMapping("/getCourseVideo")
	 public R getCourseVideo(Integer stuId){
		 List<VideoResult> courseVideo = chapterVideoService.getCourseVideo(stuId,1);
		 return R.ok().put("data", courseVideo);
	 }
	 
	 @ApiOperation("课程章节视频")
	 @GetMapping("/getChapterVideo")
	 public R getChapterVideo(Integer cid){
		 List<ChapterResult> chapterVideo = chapterVideoService.getChapterVideo(cid, 1);
		 return R.ok().put("data", chapterVideo);
	 }
	 
	 @ApiOperation("老师讲解视频课程")
	 @GetMapping("/getExplainVideo")
	 public R getExplainVideo(){
		 List<VideoResult> explainVideo = chapterVideoService.getCourseVideo(null,0);
		 return R.ok().put("data", explainVideo);
	 }

	 @ApiOperation("老师讲解课程章节视频")
	 @GetMapping("/getExplainChapterVideo")
	 public R getExplainChapterVideo(Integer cid){
		 List<ChapterResult> explainChapterVideo = chapterVideoService.getChapterVideo(cid, 0);
		 return R.ok().put("data", explainChapterVideo);
	 }
}
